using NodeCanvas.Framework;

namespace Yoozoo.Gameplay.Liberty.AI.Node
{
    public class NpcIsEmptyWeapon : AIConditionBaseNode
    {
        public int WeaponPriority = 5;
        public BBParameter<SearchType> SearchItemType;
        public BBParameter<int> ItemType;
        protected override bool OnCheck()
        {
            var weaponSystem = _entity.WeaponSystem;
            if (weaponSystem!=null)
            {
                bool hasNiubiWeapon = false;
                foreach (var weapon in weaponSystem.WeaponList)
                {
                    if (weapon.Config.priority >= WeaponPriority)
                    {
                        hasNiubiWeapon = true;
                        SearchItemType.value = SearchType.SearchItemType;
                        ItemType.value = 2;
                    }
                }

                return hasNiubiWeapon;
            }
            return false;
        }
    }
}